<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>${locale("user-title")}</title>
	<link rel="stylesheet" type="text/css" href="../lib/easyui/themes/${skin!'default'}/easyui.css"/>
	<link rel="stylesheet" type="text/css" href="../lib/easyui/themes/icon.css"/>
	<style type="text/css">
		#condition div{margin:5px 0;}
		#condition label{width:100px;text-align:right;display:inline-block;}
		#condition input{width:150px;}
		.user-edit{cursor:pointer;}
		.label{text-align:right;}
		.text input{width:200px;}
	</style>
</head>
<body class="easyui-layout">
    <!--修改-->
	<div id="update-win" title="${locale("mg-update")}" class="easyui-dialog" style="padding:10px;width:300px;" data-options="
					closed:true,modal:true,
					minimizable:false,maximizable:false,
					resizable:false,iconCls:'icon-save',
					buttons: [{
						text:'${locale("mg-ok")}',
						iconCls:'icon-ok',
						handler:function(){
							$('#update-form').submit();
						}
					},{
						text:'${locale("mg-close")}',
						handler:function(){
							$('#update-win').dialog('close');
						}
					}]">
		<form id="update-form" method="post" action="user.update.jx">
			<table>
	    		<tr>
	    			<td class="label">${locale("login-name")}</td>
	    			<td class="text">
	    				<input class="easyui-validatebox" readOnly type="text" name="name"/>
	    			</td>
	    		</tr>
	    		<tr>
	    			<td class="label">${locale("login-password")}</td>
	    			<td class="text">
	    				<input class="easyui-validatebox" type="password" maxlength="16" id="password" name="password" data-options=""/>
	    			</td>
	    		</tr>
	    		<tr>
	    			<td class="label">${locale("user-enterpass")}</td>
	    			<td class="text">
	    				<input class="easyui-validatebox" type="password" maxlength="16" id="password" name="password" data-options=""/>
	    			</td>
	    		</tr>
	    	</table>
		</form>
	</div>
	<!--添加-->
    <div id="add-win" title="${locale("mg-add")}" class="easyui-dialog" style="padding:10px;width:300px;" data-options="
                    closed:true,modal:true,
                    minimizable:false,maximizable:false,
                    resizable:false,iconCls:'icon-save',
                    buttons: [{
                        text:'${locale("mg-ok")}',
                        iconCls:'icon-ok',
                        handler:function(){
                            $('#add-form').submit();
                        }
                    },{
                        text:'${locale("mg-close")}',
                        handler:function(){
                            $('#add-win').dialog('close');
                        }
                    }]">
        <form id="add-form" method="post" action="user.insert.jx">
            <table>
                <tr>
                    <td class="label">${locale("login-name")}</td>
                    <td class="text">
                        <input class="easyui-validatebox" type="text" maxlength="20" id="name" name="name" data-options="required:true"/>
                    </td>
                </tr>
                <tr>
                    <td class="label">${locale("login-password")}</td>
                    <td class="text">
                        <input class="easyui-validatebox" type="password" maxlength="16" id="password" name="password" data-options="required:true"/>
                    </td>
                </tr>
                <tr>
                    <td class="label">${locale("user-enterpass")}</td>
                    <td class="text">
                        <input class="easyui-validatebox" type="password" maxlength="16" id="password" name="password" data-options="required:true"/>
                    </td>
                </tr>
            </table>
        </form>
    </div>
	<!--条件-->
	<div data-options="region:'north',title:'${locale("search-condition")}',border:false" style="height:130px;padding:10px 10px 0 10px;">
		<form id="condition">
			<div>
				<label>${locale("user-createtime")}　${locale("from")}</label>
				<input class="easyui-datebox" name="createTimeFrom" />
				${locale("to")}
				<input class="easyui-datebox" name="createTimeTo" />
			</div>
			<div>
				<label>${locale("user-logintime")}　${locale("from")}</label>
				<input class="easyui-datebox" name="loginTimeFrom" />
				${locale("to")}
				<input class="easyui-datebox" name="loginTimeTo" />
			</div>
			<div>
				<label>${locale("user-name")}</label>
				<input type="text" name="name" />
				<a id="search" href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search'">${locale("search-btn")}</a>
			</div>
	    </form>
	</div>
	<!--grid-->
	<div data-options="region:'center',title:'${locale("search-content")}'">
	   <table id="list"></table>
	</div>
	
	<script type="text/javascript" src="../lib/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="../lib/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../lib/locale/lang-${language!'zh_CN'}.js"></script>
	<script type="text/javascript" src="../js/common.js"></script>
	<script type="text/javascript">
		//修改
		var update = function(id){
			$("#update-win").window('open');
		};
		$(function(){
			$('#list').datagrid({
			    url:'user.search.jx',
			    fit:true,
			    rownumbers:true,
				pagination:true,
			    columns:[[
			        {field:' ',checkbox:true},
			        {field:'name',title:'${locale("user-name")}',width:160,sortable:true},
			        {field:'createTime',title:'${locale("user-createtime")}',width:150,sortable:true},
			        {field:'loginTime',title:'${locale("user-logintime")}',width:150,sortable:true},
			        {field:'id',title:'${locale("mg-update")}',width:60,align:'center',formatter:function(value,row,index){
			        	return '<img class="user-edit" src="../lib/easyui/themes/icons/edit.png" onclick="update('+value+');"/>';
			        }}
			    ]],
			    toolbar:[{
			    	text:'${locale("mg-add")}',
			    	iconCls:'icon-add',
			    	handler:function(){
			    		$("#add-win").window('open');
			    	}
			    },'-',{
			    	text:'${locale("mg-del")}',
			    	iconCls:'icon-delete',
			    	handler:function(){
			    	    var selecteds = $('#list').datagrid('getSelections');
			    	    if(selecteds.length == 0){
			    	        $.messager.alert($.language.ajax.title,$.language.ajax.noSelected);
			    	        return;
			    	    }
			    	    var param = '';
			    	    $.each(selecteds,function(i,v){
			    	        param += 'ids=' + v.id + '&';
			    	    });
			    		$.messager.confirm($.language.ajax.title,$.language.ajax.confirmMsg,function(r){
		                    if(r){
		                        $.ajax({
		                            url:'user.delete.jx?'+param,
		                            success:function(data){
		                                if($.requestSuccess(data)){
		                                	$.messager.alert($.language.ajax.title,$.language.ajax.operSuccess,'info',function(){
			                                    $('#list').datagrid('reload')
		                                	});
		                                }
		                            }
		                        });
		                    }
		                });
			    	}
			    }],
			    loadFilter:function(data){
			    	if($.requestSuccess(data)){
			    		return data;
			    	}
			    	return {"total":0,"rows":[]};
			    },
			    onLoadError:$.requestError
			});
			$("#search").click(function(){
				var params = $("#condition").serializeArray();
				var param = {};
				$.each(params,function(index,val){
					param[val.name] = val.value;
				});
				$('#list').datagrid('reload',param);
			});
		});
	</script>
</body>
</html>